
project, uses(../data_output/termlimited.dta)





	use ../data_output/termlimited.dta, clear
		
	
	reghdfe abs_wnom  termlimited  , cluster(CandId) absorb(CandId chamber_term )		
	local r4 = _b[termlimited]
	local se4 = _se[termlimited]
	local n4 = e(N)
	qui sum abs_wnom if e(sample)
	local m4 =  r(mean)
	local sd4 = r(sd)		
	
	reghdfe wnom termlimited   if party=="Dem" , cluster(CandId) absorb(CandId chamber_term )
	local r5 = _b[termlimited]
	local se5 = _se[termlimited]
	local n5 = e(N)
	qui sum wnom if e(sample)
	local m5 =  r(mean)
	local sd5 = r(sd)		
	
	reghdfe wnom termlimited   if party=="Rep" , cluster(CandId) absorb(CandId chamber_term )
	local r6 = _b[termlimited]
	local se6 = _se[termlimited]
	local n6 = e(N)
	qui sum wnom if e(sample)
	local m6 =  r(mean)
	local sd6 = r(sd)	
	
	
	
	cap log close
	quietly {
		set linesize 255
		log using "../tables_figures/voting.tex", text replace
		
		noisily dis "\begin{table}[t]"
		noisily dis "\centering"
		noisily dis "\caption{\textbf{Effect of Electoral Incentives on Legislator Voting Behavior.}"
		noisily dis "In their final term, term-limited legislators cast roll-call votes less often,"
		noisily dis " but do not appear to alter their ideological positioning.\label{tab:voting}}"
		noisily dis "\begin{tabular}{l ccc}"
		noisily dis "\toprule\toprule"
		noisily dis "&  (1) & (2) & (3) \\[2mm]"
		noisily dis "&  Abs & WNOM & WNOM  \\"
		noisily dis "&  WNOM & Dem & Rep \\"

		noisily dis "\midrule"
		noisily dis " Term Limited  & "  %4.2f `r4' " & " %4.2f `r5' " & " %4.2f `r6'   "\\"
		noisily dis "  &  (" %4.2f `se4' ") & (" %4.2f `se5' ") & (" %4.2f `se6' ")   \\[2mm]"
		noisily dis "\midrule "
		noisily dis " N & "  %8.0fc `n4' " & " %8.0fc `n5' " & " %8.0fc `n6'  "\\"
		noisily dis " Outcome Mean & "   %4.2f `m4' " & "  %4.2f `m5' " & " %4.2f `m6'   "\\"
		noisily dis " Standard Dev. & "   %4.2f `sd4' " & "  %4.2f `sd5' " & " %4.2f `sd6'   "\\"
		
		noisily dis "Chamber-Year FE & Yes & Yes & Yes  \\"
		noisily dis "Legislator FE & Yes & Yes &  Yes \\"

		noisily dis "\bottomrule \bottomrule"
		noisily dis "\multicolumn{4}{p{.5\textwidth}}{\footnotesize  "
		noisily dis " In column 1, the outcome is the absolute value of the legislator's W-NOMINATE score.  In columns 2 and 3,"
		noisily dis	"the outcome is the legislators W-NOMINATE score,"
		noisily dis " and the data is separated by Democrats and Republicans, respectively."
		noisily dis "Dataset covers the 14 state legislative chambers with term limits"
		noisily dis " of three terms or longer, and covers legislative terms following elections from 1984-2014. "
		noisily dis "Robust standard clustered by legislator in parentheses.}"	
		noisily dis "\end{tabular}"
		noisily dis "\end{table}"
	
		
		log off
	
	}
	



/*
	use ../data_output/termlimited.dta, clear
		
	xtreg pct_floorvote termlimited  i.chamber_term , cluster(CandId) fe	
	local r1 = _b[termlimited]
	local se1 = _se[termlimited]
	local n1 = e(N)
	qui sum pct_floorvote if e(sample)
	local m1 =  r(mean)
	local sd1 = r(sd)
	
	xtreg vote_party_line termlimited  i.chamber_term, cluster(CandId) fe	
	local r2 = _b[termlimited]
	local se2 = _se[termlimited]
	local n2 = e(N)
	qui sum vote_party_line if e(sample)
	local m2 =  r(mean)
	local sd2 = r(sd)	
	
	xtreg vote_against_party termlimited  i.chamber_term, cluster(CandId) fe	
	local r3 = _b[termlimited]
	local se3 = _se[termlimited]
	local n3 = e(N)
	qui sum vote_against_party if e(sample)
	local m3 =  r(mean)
	local sd3 = r(sd)	
	
	xtreg abs_wnom  termlimited  i.chamber_term, cluster(CandId) fe		
	local r4 = _b[termlimited]
	local se4 = _se[termlimited]
	local n4 = e(N)
	qui sum abs_wnom if e(sample)
	local m4 =  r(mean)
	local sd4 = r(sd)		
	
	xtreg wnom termlimited  i.chamber_term if party == "Dem", cluster(CandId) fe	
	local r5 = _b[termlimited]
	local se5 = _se[termlimited]
	local n5 = e(N)
	qui sum wnom if e(sample)
	local m5 =  r(mean)
	local sd5 = r(sd)		
	
	xtreg wnom termlimited  i.chamber_term if party == "Rep", cluster(CandId) fe	
	local r6 = _b[termlimited]
	local se6 = _se[termlimited]
	local n6 = e(N)
	qui sum wnom if e(sample)
	local m6 =  r(mean)
	local sd6 = r(sd)	
	
	
	
	cap log close
	quietly {
		set linesize 255
		log using "../tables_figures/voting.tex", text replace
		
		noisily dis "\begin{table}[t]"
		noisily dis "\centering"
		noisily dis "\caption{\textbf{Effect of Electoral Incentives on Legislator Voting Behavior.}"
		noisily dis "In their final term, term-limited legislators cast roll-call votes less often,"
		noisily dis " but do not appear to alter their ideological positioning.\label{tab:voting}}"
		noisily dis "\begin{tabular}{l cccccc}"
		noisily dis "\toprule\toprule"
		noisily dis "& (1) & (2) & (3) & (4) & (5) & (6) \\[2mm]"
		noisily dis "& Pct  & Pct & Pct Not  & Abs & WNOM & WNOM  \\"
		noisily dis "& Votes & w/ Party &  w/ Party & WNOM & Dem & Rep \\"

		noisily dis "\midrule"
		noisily dis " Term Limited  & " %4.2f `r1' " & " %4.2f `r2' " & " %4.2f `r3' " & " %4.2f `r4' " & " %4.2f `r5' " & " %4.2f `r6'   "\\"
		noisily dis "  & (" %4.2f `se1' ") & (" %4.2f `se2' ") & (" %4.2f `se3' ")  & (" %4.2f `se4' ") & (" %4.2f `se5' ") & (" %4.2f `se6' ")   \\[2mm]"
		noisily dis "\midrule "
		noisily dis " N & " %8.0fc `n1' " & " %8.0fc `n2' " & " %8.0fc `n3' " & " %8.0fc `n4' " & " %8.0fc `n5' " & " %8.0fc `n6'  "\\"
		noisily dis " Outcome Mean & "  %4.2f `m1' " & "  %4.2f `m2' " & "  %4.2f `m3' " & "  %4.2f `m4' " & "  %4.2f `m5' " & " %4.2f `m6'   "\\"
		noisily dis " Standard Dev. & "  %4.2f `sd1' " & "  %4.2f `sd2' " & "  %4.2f `sd3' " & "  %4.2f `sd4' " & "  %4.2f `sd5' " & " %4.2f `sd6'   "\\"
		
		noisily dis "Chamber-Year FE & Yes & Yes & Yes & Yes & Yes & Yes  \\"
		noisily dis "Legislator FE & Yes & Yes &  Yes & Yes & Yes & Yes\\"

		noisily dis "\bottomrule \bottomrule"
		noisily dis "\multicolumn{7}{p{.9\textwidth}}{\footnotesize  "
		noisily dis " In column 1, we show the estimate on the percentage of floor votes the legislator is present for,"
		noisily dis " as in Table \ref{tab:accountability}. "
		noisily dis " In column 2, the outcome is the percentage of votes on which the legislator votes with her party, counting abstensions as votes against her party."
		noisily dis " In column 3, the outcome is the percentage of votes on which the legislator votes against her party, counting abstensions as votes for her party."
		noisily dis " In column 4, the outcome is the absolute value of the legislator's W-NOMINATE score.  In columns 5 and 6, the outcome is the legislators W-NOMINATE score,"
		noisily dis " and the data is separated by Democrats and Republicans, respectively."
		noisily dis "Dataset covers the 14 state legislative chambers with term limits"
		noisily dis " of three terms or longer, and covers legislative terms following elections from 1984-2014. "
		noisily dis "Robust standard clustered by legislator in parentheses.}"	
		noisily dis "\end{tabular}"
		noisily dis "\end{table}"
	
		
		log off
	
	}
	
